
package com.bdtop.dbl.server.request;

import com.bdtop.dbl.server.response.GetFenceListResponse;
import com.bdtop.dbl.thirdparty.asynchttp.HttpPostRequest;
import com.bdtop.dbl.thirdparty.asynchttp.RequestCallback;
import com.bdtop.dbl.utils.Constants;
import com.bdtop.dbl.utils.DBLDebug;
import com.google.gson.Gson;

/**
 * @ClassName: GetFenceListRequest
 * @Description: TODO
 * @author: liyongqiang
 * @date:2014-10-15
 */
public class GetFenceListRequest extends HttpPostRequest {

    /**
     * @param callback
     */
    public GetFenceListRequest(RequestCallback callback) {
        super(callback);
        getRequestParams().add(Constants.COMMAND, Constants.CMD_GET_FENCE);
    }

    @Override
    protected String getUrl() {
        return Constants.SERVER_ADDRESS;
    }

    @Override
    protected Object parse(String responseString) {
        DBLDebug.logd("GetFenceListRequest, response = " + responseString);

        Gson gson = new Gson();
        GetFenceListResponse response = gson.fromJson(responseString, GetFenceListResponse.class);
        return response;
    }

    public void setParams(String loginSign, String mdn) {
        getRequestParams().add(Constants.PARAM_LOGIN_SIGN, loginSign);
        getRequestParams().add(Constants.PARAM_MDN, mdn);
    }

}
